/*
 * @Author: Lizhenyu
 * @Date: 2021-07-13 10:21:32
 * @FilePath: \usp-osm-frondend\src\api\shopConfig.js
 */
import { service } from '@/utils/request'

const api = {
  pagesList: '/admin/mdse/category/get-children',
  bannerList: '/admin/h5-config/product/kv-image/list',
  saveBanner: '/admin/h5-config/product/kv-image/save',
  categoryList: '/admin/h5-config/product/category/list',
  delPages: '/admin/h5-config/product/category/delete',
  savePages: '/admin/h5-config/product/category/save',
  updateSort: '/admin/h5-config/product/category/sort-update',
  previewPage: '/admin/h5-config/product/preview',
  saveConfig: '/admin/h5-config/product/publish',
  refresh: '/admin/h5-config/product/category/refresh'
}

export function getPagesList (data) {
  return service({
    url: api.pagesList,
    method: 'post',
    data
  })
}

export function getBannerList (data) {
  return service({
    url: api.bannerList,
    method: 'post',
    data
  })
}

export function getSaveBanner (data) {
  return service({
    url: api.saveBanner,
    method: 'post',
    data
  })
}

export function getCategoryList () {
  return service({
    url: api.categoryList,
    method: 'get'
  })
}

export function getDelPages (id) {
  return service({
    url: api.delPages + '/' + id,
    method: 'DELETE'
  })
}

export function getSavePage (data) {
  return service({
    url: api.savePages,
    method: 'post',
    data
  })
}

export function getUpdateSort (data) {
  return service({
    url: api.updateSort,
    method: 'post',
    data
  })
}

export function getPreviewPage (data) {
  return service({
    url: api.previewPage,
    method: 'post',
    data
  })
}

export function getSaveConfig (data) {
  return service({
    url: api.saveConfig,
    method: 'post',
    data
  })
}

export function getRefreshData (data) {
  return service({
    url: api.refresh,
    method: 'post',
    data
  })
}
